package javeriana.edu.co.acceleo.Util;

import java.util.HashMap;
import java.util.Map.Entry;


public class Utils {
	public static HashMap<String,String> entities=new HashMap<>();
	public Integer insert(String entity){
		if(entities.containsKey(entity)==false){
			entities.put(entity, entity);
		}
		return entities.size();
	}
	public Double div(Double r1, Double r2){
		return r1/r2;
	}
	public String generateEntites(){
		String values="";
		for (Entry<String, String> entry : entities.entrySet()) {
		    String value = entry.getValue();
		    values+="	private jpa.entities."+value+" "+value.toLowerCase()+" = new jpa.entities."+value+"();\n";
		}
		return values;
	}
	public String generateSetGet(){
		String values="";
		for (Entry<String, String> entry : entities.entrySet()) {
		    String value = entry.getValue();
		    //values+="	public void set"+value+"(jpa.entities."+value+" "+value.toLowerCase()+"){\n		this."+value.toLowerCase()+" = "+value.toLowerCase()+";\n	}\n";
		    values+=" 	public jpa.entities."+value+" get"+value+"(){\n		return this."+value.toLowerCase()+";\n	}\n";
		}
		return values;
	}


}
